window.name='refresh';
function hide(){
    if($("#searchid").css("display")=="none"){
        $("#searchid").css("display","block");
        $("#hide").text("收起筛选")
    }else if($("#searchid").css("display")=="block"){
        $("#searchid").css("display","none");
        $("#hide").text("打开筛选")
    }
}
function gj(classify,name,sale,scname,status,auditstatus){
    console.log(status);
    layui.use('table', function () {
        var table=layui.table;
        table.reload('demo',{
            where:{
                classify:classify,
                name:name,
                sale:sale,
                scname:scname,
                status:status,
                auditstatus:auditstatus
            }
        })
    })
}
function refresh1() {
    tableIn.reload("demo");
}
var tableIn=null;
var title1=null;
var data1=null;
    layui.use(['table','dropdown','form','laydate'], function () {
        var laydate=layui.laydate
        var form=layui.form
        var dropdown = layui.dropdown
        var table = layui.table;
        laydate.render({
            elem: '#test30'
            ,theme: '#393D49'
        });
        table.on('tool(test)', function(obj){
            var data = obj.data;
            var layEvent = obj.event;
            var tr = obj.tr;
            if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    // 向服务端发送删除指令
                    console.log(data.id);
                    $.ajax({
                        type: 'post',
                        url: '/JsProduct/advanced/delrizhi',
                        data: {id:data.id},
                        dataType: 'json',
                        success: function (res) {
                            if(res.state==200){
                                obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                                layer.close(index);
                            }
                        }
                    })

                });
            }
        });
        dropdown.render({
            elem: '#demo1', //可绑定在任意元素中，此处以上述按钮为例
            data:data1
            ,id: 'demo1'
            //菜单被点击的事件
            ,click: function(obj){
                console.log(obj.title);
                title1=obj.title;
                table.reload('demo',{
                    where:{
                        courseclass:title1
                    }
                })
                // layer.msg('回调返回的参数已显示再控制台');
            }
        });
        //第一个实例
        tableIn = table.render({
            elem: '#demo'
            , height: 800
            , id: 'demo'
            , url: '/JsProduct/advanced/gettablelog' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                {type: 'checkbox', fixed: 'left'},
                {field: 'id', title: '序号'},
                {field: 'name', title: '管理员名称'},
                {field: 'operatelist', title: '操作的列表'},
                {field: 'operatetime', title: '执行时间'},
                {field: 'operatetype', title: '操作类型'},
                {field: 'operateremark', title: '备注'},
                {title: '操作', toolbar: '#barDemo',width:100}
            ]],
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "state": res.state, //解析接口状态
                    "message": res.message, //解析提示文本0
                    "total": res.total, //解析数据长度
                    "data": res.data, //解析数据列表
                    "code":res.state,
                    "count":res.total,//解析数据长度
                };
            },
        });
        $("#selectkc").click(function(){
            let val=form.val("formfilter");
            console.log(val);
            console.log(val.name);
            table.reload('demo',{
                where:{
                    name:val.name,
                    operatelist:val.operatelist,
                    date:val.operatetime,
                    operatetype:val.operatetype
                }
            })
        })
});
